package o;

import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.RelativeLayout;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import o.exp.d;

public class fbs extends fbu {
    private ViewGroup ˋ;
    private int ˎ = 2;
    private int ॱ = -1;

    public fbs(Context context, boolean z) {
        super(context, z);
    }

    public void ˊ(int i) {
        this.ˎ = i;
    }

    public int ˋ() {
        return this.ॱ;
    }

    public void ॱ(int i) {
        this.ॱ = i;
    }

    public void ˏ(CardBean cardBean) {
        ˎ();
        super.ˏ(cardBean);
    }

    public cgz ˏ(View view) {
        super.ˏ(view);
        view.setBackgroundDrawable(null);
        this.ˋ = (ViewGroup) view.findViewById(d.ʻᐝ);
        return this;
    }

    private void ˎ() {
        int ᐝ;
        int ˋ = ˋ();
        if (ˋ < 0) {
            ᐝ = ᐝ();
        } else {
            ᐝ = ˋ;
        }
        LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.ʽॱ.getLayoutParams();
        if (layoutParams == null) {
            layoutParams = new RelativeLayout.LayoutParams(-1, -2);
        }
        layoutParams.width = (azb.ॱ(this.ʼॱ) - ᐝ) / this.ˎ;
        layoutParams.height = (int) (((float) layoutParams.width) / 2.0f);
        this.ʽॱ.setLayoutParams(layoutParams);
        if (this.ˋ != null) {
            LayoutParams layoutParams2 = this.ˋ.getLayoutParams();
            if (layoutParams2 != null) {
                layoutParams2.width = layoutParams.width;
            }
        }
    }

    public void ॱ(final chy o_chy) {
        OnClickListener anonymousClass2 = new evx(this) {
            final /* synthetic */ fbs ˋ;

            public void ˋ(View view) {
                o_chy.ˏ(0, this.ˋ);
            }
        };
        super.ॱ(o_chy);
        this.ʽॱ.setOnClickListener(anonymousClass2);
    }

    public int ᐝ() {
        return (azb.ˊ(this.ʼॱ) + azb.ˏ(this.ʼॱ)) + (this.ʼॱ.getResources().getDimensionPixelSize(exp$a.ʽॱ) * (this.ˎ - 1));
    }
}
